package ch1.ex7;

class StaticTest{
	static int i = 47;
}
class Incrementator{
	static void increment(){
		StaticTest.i++;
	}
}
public class Incrementable {
	public static void main(String[] args){
		System.out.println(" Static variable 'i' has initial value: " + StaticTest.i);
		StaticTest st1 = new StaticTest();
		StaticTest st2 = new StaticTest();
		System.out.println(" Static variable 'st1' initial value: " + st1.i);
		System.out.println(" Static variable 'st2' initial value: " + st2.i);
		Incrementator inc = new Incrementator();
		inc.increment();
		System.out.println(" After invoking of inc.increment() function: ");
		System.out.println(" Static variable 'st1' initial value: " + st1.i);
		System.out.println(" Static variable 'st2' initial value: " + st2.i);
		Incrementator.increment();
		System.out.println(" After invoking of Incrementator.increment() function: ");
		System.out.println(" Static variable 'st1' initial value: " + st1.i);
		System.out.println(" Static variable 'st2' initial value: " + st2.i);
	}
}
